package com.t2t.top.devops.controller;

import com.t2t.top.base.controller.BaseController;
import com.t2t.top.devops.model.dto.AccountDto;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by yangpengfei on 2015/12/4.
 */
public class CommonController extends BaseController {
    public AccountDto getAccount() {
        AccountDto account = (AccountDto)getRequest().getSession().getAttribute("AUTH_USER");
        return account;
    }

    public HttpServletRequest getRequest() {
        ServletRequestAttributes attr = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
        return attr.getRequest();
    }
}
